<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('测评成绩报告信息列表')" />
    <th:block th:include="include :: select2-css"/>
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>测评表id：</label>
                                <input type="text" name="scaleId"/>
                            </li>
                            <li>
                                <label>测评标题：</label>
                                <input type="text" name="scaleTitle"/>
                            </li>
<!--                            <li>-->
<!--                                <label>用户id：</label>-->
<!--                                <input type="text" name="userId"/>-->
<!--                            </li>-->
                            <li>
                                <label>登录账号：</label>
                                <input type="text" name="loginName"/>
                            </li>
                            <li>
                                <label>用户昵称：</label>
                                <input type="text" name="userName"/>
                            </li>
                            <li>
                                <label>总分：</label>
                                <input type="text" name="countScore"/>
                            </li>
                            <li>
                                <label>因子分数：</label>
                                <input type="text" name="factorScore"/>
                            </li>
                            <li>
                            <li>

                                <label  >班级：</label>
                                <select name="classesId" class="form-control " th:with="classes=${@classesService.selectAllClasses(null)}">
                                    <option value="">所有</option>
                                    <option th:each="c : ${classes}" th:text="${c.classesName}"  ></option>
                                </select>
                            </li>
                            </li>
                            <li>
                                <label>所属学院：</label>
                                <div class="col-sm-8">
                                    <select name="deptName"  class="form-control " th:with="dept=${@deptService.selectAllDept(null)}">
                                        <option value="">所有</option>
                                        <option th:each="d : ${dept}" th:text="${d.deptName}" th:value="${d.deptName}">
                                    </select>
                                </div>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
<!--                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:result_user:add">-->
<!--                    <i class="fa fa-plus"></i> 添加-->
<!--                </a>-->
<!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:result_user:edit">-->
<!--                    <i class="fa fa-edit"></i> 修改-->
<!--                </a>-->
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:result_user:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
<!--                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:result_user:export">-->
<!--                    <i class="fa fa-download"></i> 导出-->
<!--                </a>-->
                <i class="fa fa-info-circle" style="color: red;"></i> 勾选数据导出指定列，否则为全部
                <a class="btn btn-warning" onclick="exportSelected()" shiro:hasPermission="system:result_user:export">
                    <i class="fa fa-download"></i> 导出    </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
     <th:block th:include="include :: select2-js"/>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:result_user:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:result_user:remove')}]];
        var prefix = ctx + "system/result_user";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                clickToSelect: true,
                rememberSelected: true,
                modalName: "测评成绩报告信息",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'resultId',
                    title: '测评结果id',
                    visible: false
                },
                {
                    field: 'scaleTitle',
                    title: '测评量名称'
                },
                {
                    field: 'loginName',
                    title: '登录账号',
                    visible: false
                },
                {
                    field: 'userName',
                    title: '用户昵称'
                },
                    {
                        field: 'classesName',
                        title: '班级'
                    },
                    {
                        field: 'deptName',
                        title: '学院'
                    },
                {
                    field: 'countScore',
                    title: '总分'
                },
                {
                    field: 'factorScore',
                    title: '因子分数'  ,
                    width: '15',
                    widthUnit: '%',
                },
                {
                    field: 'resultContent',
                    title: '分数范围和结果提示',
                    width: '15',
                    widthUnit: '%',
                    align: "left",
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value);
                    }
                },
                {
                    field: 'factorResult',
                    title: '因子的分数范围及结果提示'  ,
                    width: '15',
                    widthUnit: '%',
                    align: "left",
                    formatter: function (value, row, index) {
                        return $.table.tooltip(value);
                    }
                },
                    {
                        field: 'userAnswer',
                        title: '用户选择数据' ,
                        width: '15',
                        widthUnit: '%',
                        align: "left",
                        formatter: function (value, row, index) {
                            return $.table.tooltip(value);
                        }
                    },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.resultId + '\')"><i class="fa fa-edit"></i>详情</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.resultId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });


        /* 勾选 导出用户信息 */
        function exportSelected() {
            var resultIds = $.table.selectColumns("resultId");
            var dataParam = $("#export-form").serializeArray();
            var tipMsg = "确定导出所有数据吗？";
            if ($.common.isNotEmpty(resultIds)) {
                tipMsg = "确定导出勾选" + resultIds.length + "条数据吗？";
                dataParam.push({"name": "resultIds", "value": resultIds});
            }
            $.modal.confirm(tipMsg, function () {
                $.post(prefix + "/exportData", dataParam, function (result) {
                    if (result.code == web_status.SUCCESS) {
                        window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true;
                    } else {
                        $.modal.alertError(result.msg);
                    }
                });
            });
        }
    </script>
</body>
</html>